package com.example.springbatch3;

import org.springframework.batch.core.JobParameters;
import org.springframework.batch.core.JobParametersInvalidException;
import org.springframework.batch.core.JobParametersValidator;
import org.springframework.util.StringUtils;

public class NameParamValidator implements JobParametersValidator {
    @Override
    public void validate(JobParameters jobParameters) throws JobParametersInvalidException {
        String name = jobParameters.getString("name");

        if (!StringUtils.hasText(name)){
            throw new JobParametersInvalidException("name 不能为null或者空串！");
        }

        System.out.println("校验通过");

    }
}
